<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
  
  <head>
    <meta charset="UTF-8">
    <title>订单与用户信息管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/css/font.css">
    <link rel="stylesheet" href="/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
  </head>

  <body>
    <div class="x-body">

      <!---------------------------------------------------    新增    --------------------------------------------->
      <div class="modal" id="add">
              <div class="orderbox">
                <form action="/stu/order-save" method="post" class="layui-form">
          <div class="layui-form-item">
            <label  class="layui-form-label">
              <span class="x-red">*</span>订单号
            </label>
            <div class="layui-input-inline">
              <input type="text" name="num" required="" lay-verify="required" autocomplete="off"
                     class="layui-input">
            </div>
          </div>

          <div class="layui-form-item">
            <label  class="layui-form-label">
              <span class="x-red">*</span>收货人
            </label>
            <div class="layui-input-inline">
              <input type="text" name="name" required="" lay-verify="required" autocomplete="off"
                     class="layui-input">
            </div>
          </div>


          <div class="layui-form-item">
            <label class="layui-form-label">
              <span class="x-red">*</span>手机
            </label>
            <div class="layui-input-inline">
              <input type="text"  name="phone" required="" lay-verify="phone" autocomplete="off"
                     class="layui-input">
            </div>
          </div>

          <div class="layui-form-item">
            <label  class="layui-form-label">
              <span class="x-red">*</span>收货地址
            </label>
            <div class="layui-input-inline">
              <input type="text"  name="address" required="" lay-verify="required"
                     autocomplete="off" class="layui-input">
            </div>
          </div>

          <div class="layui-form-item">
            <label  class="layui-form-label">
              <span class="x-red">*</span>应付金额
            </label>
            <div class="layui-input-inline">
              <input type="text"  name="Allamount" required="" lay-verify="required"
                     autocomplete="off" class="layui-input">
            </div>
          </div>


          <div class="layui-form-item">
            <label  class="layui-form-label">
              <span class="x-red">*</span>实付金额
            </label>
            <div class="layui-input-inline">
              <input type="text"  name="amount" required="" lay-verify="required"
                     autocomplete="off" class="layui-input">
            </div>
          </div>

          <div class="layui-form-item">
            <label  class="layui-form-label">
              <span class="x-red">*</span>支付状态
            </label>
            <div class="layui-input-inline">
              <input type="text"  name="PaymentStatus" required="" lay-verify="required"
                     autocomplete="off" class="layui-input" placeholder="已支付/未支付">
            </div>
          </div>

          <div class="layui-form-item">
            <label  class="layui-form-label">
              <span class="x-red">*</span>发货状态
            </label>
            <div class="layui-input-inline">
              <input type="text"  name="shipmentStatus" required="" lay-verify="required"
                     autocomplete="off" class="layui-input" placeholder="已发货/未发货">
            </div>
          </div>



          <div class="layui-form-item">
            <label class="layui-form-label">
            </label>
            <button class="layui-btn" lay-filter="add" lay-submit="">
              增加
            </button>
            <a class="layui-btn " href="javascript:location.replace(location.href);">
              返回
            </a>
          </div>
      </form>
        </div>
      </div>


      <!-------------------------------------------------所有信息------------------------------------------------->
      <xblock id="xbox">
        <button class="layui-btn add" onclick="add()"><i class="layui-icon"></i>添加</button>
        <span class="x-right" style="line-height:40px">共有数据：<span th:text="${ordersize}"></span> 条</span>
      </xblock>

      <table class="layui-table">
        <thead>
          <tr>
            <th>订单编号</th>
            <th>收货人</th>
            <th>总金额</th>
            <th>应付金额</th>
            <th>支付状态</th>
            <th>发货状态</th>
            <th>下单时间</th>
            <th >操作</th>
            </tr>
        </thead>
        <tbody>
          <tr th:each="order:${orderlist}">
            <td>[[${order.num}]]</td>
            <td>[[${order.name}]]</td>
            <td>[[${order.allamount}]]</td>
            <td>[[${order.amount}]]</td>
            <td>[[${order.paymentStatus}]]</td>
            <td>[[${order.shipmentStatus}]]</td>
            <td>[[${order.creatTime}]]</td>
            <td class="td-manage">
              <a title="查看" onclick="edit( $(this).attr('id'))" th:id="${order.num}" href="javascript:;">
                <i class="layui-icon">&#xe642;</i>
              </a>
              <a title="删除" th:href="'/stu/order-delect/'+${order.num}" >
                <i class="layui-icon">&#xe640;</i>
              </a>
            </td>

<!----------------------------------------------修改------------------------------------------------>

            <div class="modal" th:id="'edit'+${order.num}">
              <div class="orderbox">
                <form action="/stu/order-edit" method="post" class="layui-form">
                    <div class="layui-form-item">
                      <label  class="layui-form-label">
                        <span class="x-red">*</span>订单号
                      </label>
                      <div class="layui-input-inline">
                        <input type="text"required="" lay-verify="required" autocomplete="off"
                               class="layui-input" name="num" th:value="${order.num}" readonly="readonly">
                      </div>
                    </div>

                    <div class="layui-form-item">
                      <label  class="layui-form-label">
                        <span class="x-red">*</span>收货人
                      </label>
                      <div class="layui-input-inline">
                        <input type="text"  required="" lay-verify="required" autocomplete="off"
                               class="layui-input" name="name"  th:value="${order.name}">
                      </div>
                    </div>


                    <div class="layui-form-item">
                      <label class="layui-form-label">
                        <span class="x-red">*</span>手机
                      </label>
                      <div class="layui-input-inline">
                        <input type="text"   required="" lay-verify="phone" autocomplete="off"
                               class="layui-input" name="phone"  th:value="${order.phone}">
                      </div>
                    </div>

                    <div class="layui-form-item">
                      <label  class="layui-form-label">
                        <span class="x-red">*</span>收货地址
                      </label>
                      <div class="layui-input-inline">
                        <input type="text"   required="" lay-verify="required"
                               autocomplete="off" class="layui-input" name="address" th:value="${order.address}">
                      </div>
                    </div>

                    <div class="layui-form-item">
                      <label  class="layui-form-label">
                        <span class="x-red">*</span>应付金额
                      </label>
                      <div class="layui-input-inline">
                        <input type="text"   required="" lay-verify="required"
                               autocomplete="off" class="layui-input" name="Allamount" th:value="${order.Allamount}">
                      </div>
                    </div>


                    <div class="layui-form-item">
                      <label  class="layui-form-label">
                        <span class="x-red">*</span>实付金额
                      </label>
                      <div class="layui-input-inline">
                        <input type="text"   required="" lay-verify="required"
                               autocomplete="off" class="layui-input"  name="amount" th:value="${order.amount}">
                      </div>
                    </div>

                    <div class="layui-form-item">
                      <label  class="layui-form-label">
                        <span class="x-red">*</span>支付状态
                      </label>
                      <div class="layui-input-inline">
                        <input type="text"  required="" lay-verify="required"
                               autocomplete="off" class="layui-input" placeholder="已支付/未支付"   name="PaymentStatus" th:value="${order.PaymentStatus}">
                      </div>
                    </div>

                    <div class="layui-form-item">
                      <label  class="layui-form-label">
                        <span class="x-red">*</span>发货状态
                      </label>
                      <div class="layui-input-inline">
                        <input type="text"  required="" lay-verify="required"
                               autocomplete="off" class="layui-input" placeholder="已发货/未发货"  name="shipmentStatus"th:value="${order.shipmentStatus}">
                      </div>
                    </div>



                    <div class="layui-form-item">
                      <label class="layui-form-label">
                      </label>
                      <button class="layui-btn" lay-filter="add" lay-submit="">
                        更改
                      </button>
                      <a class="layui-btn " href="javascript:location.replace(location.href);">
                        返回
                      </a>
                    </div>
                </form>
              </div>
            </div>
          </tr>
        </tbody>
      </table>
    </div>
    <script th:inline="javascript">
      <!--增加-->
      function add(){
        $("#add").show();
      }

      <!--修改-->
      function edit(id){
        $("#edit"+id).show();
        $("#xbox").hide();
      }
    </script>
  </body>


</html>